import './styles/index.scss';
// import imgs from './images/';
import ScrollToAnchor from './js/ScrollToAnchor.js';



document.querySelectorAll('.ibg').forEach(el => {
  let src = el.querySelector('img').getAttribute('src');
  el.style.backgroundImage = `url('${src}')`;
});



document.addEventListener("DOMContentLoaded", () => {
  var scrollToAnchor = new ScrollToAnchor();
  updateSizes();
});




var container = document.querySelector('.index-block__right');
var content = document.getElementById('img-face');

function updateSizes() {
  if (container === null || container === null) {
    return;
  }

  var availableWidth = container.getBoundingClientRect().width;
  var availableHeight = container.getBoundingClientRect().height;
  var contentWidth = content.offsetWidth;
  var contentHeight = content.offsetHeight;

  var scale = Math.min( 
    availableWidth / contentWidth, 
    availableHeight / contentHeight 
  );

  content.style.transform = `scale(${scale})`
}

window.addEventListener('resize', (event) => {
  updateSizes();
}, true);






